package com.api.dispose.base;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.alibaba.fastjson.JSON;
import com.api.entity.RequestParams;
import com.api.util.DesUtil;

public class DesDispose extends BaseDispose{
	
	/**
	 *  我这边就举个栗子
	 *  每个公司 用到的加密方式都不一样
	 *  继承BaseDispose 就是方便调用 disposeRequest()
	 */
	
	/**
	 *	把参数加密
	 */
	public  Map<String, String> disposeRequest(List<RequestParams> list){
		Map<String, String> temp_map = super.disposeRequest(list);
		Map<String, String> map = new HashMap<String, String>();
		if(map != null){
			map.put("data", DesUtil.encode(JSON.toJSONString(temp_map)));
		}
		return map;
	}
	//des解密
	public  String disposeResponse(String responseStr){
		if(StringUtils.isNotEmpty(responseStr)){
			responseStr = DesUtil.decode(responseStr);
		}
		return responseStr;
	}
}
